package com.swak.frame.ratelimit.interceptor;

import java.util.Arrays;
import org.aopalliance.aop.Advice;
import com.google.common.collect.Sets;
import com.swak.frame.interceptor.annotation.SwakAnnotationBeanPostProcessor;
import com.swak.frame.ratelimit.annotation.RateLimit;

@SuppressWarnings("serial")
public class RaterAnnotationBeanPostProcessor extends SwakAnnotationBeanPostProcessor {

	private RateLimitInterceptor rateLimitInterceptor;

	public RaterAnnotationBeanPostProcessor() {
		super(Sets.newHashSet(Arrays.asList(RateLimit.class)));
	}

	public RaterAnnotationBeanPostProcessor(RateLimitInterceptor rateLimitInterceptor) {
		super(Sets.newHashSet(Arrays.asList(RateLimit.class)));
		this.rateLimitInterceptor = rateLimitInterceptor;
	}

	public void setRateLimitInterceptor(RateLimitInterceptor rateLimitInterceptor) {
		this.rateLimitInterceptor = rateLimitInterceptor;
	}

	@Override
	public Advice getAnnotationAdvice() {
		return this.rateLimitInterceptor;
	}
}
